package com.ikingtech.platform.service.system.role.service;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ikingtech.framework.sdk.context.security.Me;
import com.ikingtech.framework.sdk.department.api.DeptRoleDataScopeApi;
import com.ikingtech.platform.service.system.role.entity.RoleDataScopeDO;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

/**
 * @author tie yan
 */
@Service
@RequiredArgsConstructor
public class DeptRoleDataScopeService implements DeptRoleDataScopeApi {

    private final RoleDataScopeRepository roleDataScopeService;

    @Override
    public void deleteRoleDataScopeByDeptId(String deptId) {
        this.roleDataScopeService.remove(Wrappers.<RoleDataScopeDO>lambdaQuery()
                .eq(RoleDataScopeDO::getDataScopeCode, deptId)
                .eq(RoleDataScopeDO::getTenantCode, Me.tenantCode()));
    }
}
